﻿using System;
using System.Security.Cryptography;

namespace Pay.DTO.hfpay {
	/// <summary>
	/// 报文信息
	/// </summary>
	public class HFBankData<HEAD, BODY> where HEAD : new() where BODY : new() {
		public HFBankData() {
			head = new HEAD();
			body = new BODY();
		}
		public HEAD head { get; set; }
		public BODY body { get; set; }
	}
	/// <summary>
	/// 基本请求报文
	/// </summary>
	public class head_base {
		private string _trandId;
		private string _tranTime;
		private string _platCode;
		private string _merNo;

		public head_base() {
			_trandId = DateTime.Now.ToString("yyyyMMdd") + _platCode + DtoHelper.RandCode(10);
			_tranTime = DateTime.Now.ToString("yyyyMMddhhmmss");
#if DEBUG
			_platCode = "1054";
			//_merNo = "5321001078";
#else
			_platCode = "1044";
			//_merNo = "5321001155";
#endif
		}

		/// <summary>
		/// 交易代码
		/// </summary>
		public string tranCode { get; set; }
		/// <summary>
		/// 交易流水号
		/// </summary>
		public string tranId {
			get { return _trandId; }
			set { _trandId = value; }
		}
		/// <summary>
		/// 交易时间
		/// </summary>
		public string tranTime {
			get { return _tranTime; }
			set { _tranTime = value; }
		}
		/// <summary>
		/// 平台代码
		/// </summary>
		public string platCode {
			get { return _platCode; }
			set { _platCode = value; }
		}
		/// <summary>
		/// 商户号
		/// </summary>
		public string merNo {
			get { return _merNo; }
			set { _merNo = value; }
		}
		/// <summary>
		/// 签名域
		/// </summary>
		public string signature { get; set; }
	}
	/// <summary>
	/// 基本响应报文
	/// </summary>
	public class body_base {
		private string _respCode = "";
		/// <summary>
		/// 应答码
		/// </summary>
		public string respCode {
			get { return _respCode; }
			set { _respCode = value; }
		}
		/// <summary>
		/// 应答描述
		/// </summary>
		public string respMsg { get; set; }
		public string transDate { get; set; }
	}

	public class test_body_base : body_base {
		/// <summary>
		/// 退款成功:0-成功；1-未知；2-失败;
		/// 当是4是为快捷支付查询成功
		/// </summary>
		public string state { get; set; }
		public string origRespCode { get; set; }
		/// <summary>
		/// 网关支付返回
		/// </summary>
		public string requestUrl { get; set; }
		public string origTranState { get; set; }
	}
}
